package tech.aistar.controller.comment;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import tech.aistar.service.comment.IAnswerService;
import tech.aistar.service.comment.ICommentService;

import javax.servlet.http.HttpSession;

/**
 * Created by Administrator on 2019/10/3 0003.
 */
@Controller
public class PraiseController {
    @Autowired
    private ICommentService commentService;

    @Autowired
    private IAnswerService answerService;

    @RequestMapping("/praise")
    @ResponseBody
    public Integer praise(Model model,Integer id,HttpSession session){

        commentService.comCounts(id);
        Integer pid = commentService.comCounts(id);


        session.setAttribute("pid",pid);
        return 1;
    }

    @RequestMapping("/anpraise")
    @ResponseBody
    public Integer anpraise(Model model, Integer id){
       answerService.ancounts(id);


        return 1;
    }
}
